package es.tikitaka.dictionary;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import org.hibernate.validator.Max;
import org.hibernate.validator.Min;
import org.hibernate.validator.NotNull;

/**
 * 
 * @author Saúl Domínguez
 * @since 2010
 * @category PFC
 */

@Entity
@Table(name = "ANIOSDIC")
public class AniosDic {

	private Integer id;
	private int anio;

	/**
	 * Constructor por defecto
	 */
	public AniosDic() {
		// TODO Auto-generated constructor stub
	}

	/**
	 * 
	 * @return id Id del año
	 */
	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ANIO_GEN")
	@SequenceGenerator(allocationSize = 1, name = "ANIO_GEN", sequenceName = "ANIO_SEQ")
	@Column(name = "X_ANIO", nullable = false, precision = 10, scale = 0)
	public Integer getId() {
		return id;
	}

	/**
	 * 
	 * @param id
	 */
	public void setId(Integer id) {
		this.id = id;
	}

	/**
	 * 
	 * @return anio Año
	 */
	@Column(name = "ANIO")
	@Min(2000)
	@Max(2100)
	@NotNull
	public int getAnio() {
		return anio;
	}

	/**
	 * 
	 * @param anio
	 */
	public void setAnio(int anio) {
		this.anio = anio;
	}

	/**
	 * Método equals
	 */
	@Override
	public boolean equals(Object obj) {
		if (!(obj instanceof AniosDic)) {
			return false;
		}
		if (obj != null) {
			if (this.id == ((AniosDic) obj).getId())
				return true;
		}
		return false;

	}

	/**
	 * Método hashCode
	 */
	@Override
	public int hashCode() {
		// TODO Auto-generated method stub
		return super.hashCode();
	}
}
